/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

/**
 * <p>Project: jse2303 - Ex2
 * <p>Powered by webrx On 2023-07-18 14:05:41
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Ex2 {
    public static void main(String[] args) {
        String pwd = "admin123456789";
        String p = "[a-zA-Z]\\w{5,11}";
        System.out.println(pwd.matches(p));

        //强密码 小写 大写 数字 特殊符号 > 8位
        //不合格  弱>=6 中等 >=6 强 >=8


        String pw = "adminAaaa";

        //1
        if (pw.length() < 6) {
            System.out.println("不合格");
        } else if (pw.length() >= 8 && pw.matches(".*[a-z].*") && pw.matches(".*[A-Z].*") && pw.matches(".*[0-9].*") && pw.matches(".*[^\\w].*")) {
            System.out.println("强");
        } else if (pw.length() >= 6 && pw.matches(".*[a-z].*") && pw.matches(".*[A-Z].*")) {
            System.out.println("中等");
        } else if (pw.length() >= 6 && pw.matches(".*[a-z].*") && pw.matches(".*[0-9].*")) {
            System.out.println("中等");
        } else if (pw.length() >= 6 && pw.matches(".*[0-9].*") && pw.matches(".*[A-Z].*")) {
            System.out.println("中等");
        } else if (pw.length() >= 6 && pw.matches(".*[a-z].*") && pw.matches(".*[A-Z].*")) {
            System.out.println("中等");
        }
    }
}
